import {
  Entity,
  JoinColumn,
  Column,
  OneToOne,
  PrimaryGeneratedColumn,
} from 'typeorm'
import { User } from './user.entity'

@Entity()
export class Profile {
  @PrimaryGeneratedColumn()
  id: number

  @Column()
  gender: string

  @Column()
  photo: string

  @Column()
  address: string

  @OneToOne(() => User) // 关联User实体，定义一对一关系
  @JoinColumn({ name: 'userId' }) // 指定外键列名，不设置typeorm则自动生成
  user: User
}
